const DB = require('../../lib/DB')

module.exports = async function (ctx, next) {
    const sorts = await (await DB.models.drug_sort.findAll({ attributes: ['sort_name', 'id'] })).map(e => {
        // 构建格式
        return {
            text: e.sort_name,
            value: e.id,
        }
    })
    ctx.body = sorts;
    await next();
}